package com.ym.manager.admin.bank;

import com.ym.datasource.DataSourceType;
import com.ym.datasource.UseDataSource;
import com.ym.utils.Pages;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @Author: dhf
 * @ClassName: BankServer
 * @Date: 2022/9/2 22:34
 * @Description:
 * @Version: 1.0
 */
@Service
public class BankServer {
    @Autowired
    private BankDao bankDao;

    @UseDataSource(DataSourceType.YS_IM)
    public Pages<Map<String,Object>> getList(int pageNum, int limit) {
        Map<String,Object> map = new HashMap<>();
        int begin = (pageNum-1)*limit;
        map.put("begin",begin);
        map.put("limit",limit);
        int count  = bankDao.getListCount(map);
        Pages<Map<String,Object>> pages = new Pages<>(count,pageNum,limit);
        List<Map<String,Object>> list = bankDao.getList(map);
        pages.setList(list);
        return pages;
    }
}
